//
//  SCUserInfoViewModel.m
//  Mutal
//
//  Created by TonyStart on 16/10/24.
//  Copyright © 2016年 com.wx. All rights reserved.
//

#import "SCUserInfoViewModel.h"
#import "SCNetworkTool.h"
#import "SCUserInfoModel.h"
@implementation SCUserInfoViewModel
-(void)requestUserInfoByUserId:(NSString*)userId finish:(void(^)(id data,NSInteger code))finish{
    //Appapi&m=user&a=info&uid=1
    
    NSDictionary *param = @{@"g":@"Appapi",@"m":@"user",@"a":@"info",@"uid":userId};
    NSString *url = urlMakeWithDict(param);
    
    [[SCNetworkTool shared] requestDataWithMethod:GET url:url finish:^(id data, NSError *err,NSInteger code) {
        finish(data,code);
    }];
}

-(void)requestUserLoginWithName:(NSString*)name password:(NSString*)password finish:(void(^)(id data,NSInteger code)) finish{
    //?g=Appapi&m=user&a=dologin&username=13699481491&password=shuchang
//    NSString *userInfoPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/userInfo.plist"];
    NSDictionary *param = @{@"g":@"Appapi",@"m":@"user",@"a":@"dologin",@"username":name,@"password":password};
    NSString *url = urlMakeWithDict(param);
    
    [[SCNetworkTool shared] requestDataWithMethod:GET url:url finish:^(id data, NSError *err,NSInteger code) {
            finish(data,code);
    
    }];
}
@end
